<template id="root">
    <el-form :model="ruleForm">
        <el-descriptions column="3" direction="vertical" border>
            <el-descriptions-item label="学号" prop="num">
                {{ $store.state.userInfo.stuNum }}</el-descriptions-item>
            <el-descriptions-item label="姓名" prop="name">{{ $store.state.userInfo.stuName }}</el-descriptions-item>
            <el-descriptions-item label="性别" prop="sex">{{ $store.state.userInfo.stuSex === 0 ? '女' : '男'}}</el-descriptions-item>
            <el-descriptions-item label="年龄" prop="age">{{ $store.state.userInfo.stuAge }}</el-descriptions-item>
            <el-descriptions-item label="电话号码" prop="phone">{{ $store.state.userInfo.stuPhone }}</el-descriptions-item>
            <el-descriptions-item label="校区" prop="address">{{ $store.state.userInfo.stuAddress }}</el-descriptions-item>
            <el-descriptions-item label="专业" prop="major">{{ $store.state.userInfo.stuMajor }}</el-descriptions-item>
            <el-descriptions-item label="年级" prop="grade">{{ $store.state.userInfo.stuGrade }}</el-descriptions-item>
        </el-descriptions>
        <el-descriptions>
            <el-descriptions-item label="预约时间">
                <el-select v-model="ruleForm.time" placeholder="请选择">
                    <el-option v-for="item in options" :key="item.time" :label="item.label" :value="item.label">
                    </el-option>
                </el-select>
                <span>-</span>
                <el-select v-model="ruleForm.time1" placeholder="请选择">
                    <el-option v-for="item in options1" :key="item.time1" :label="item.labe2" :value="item.labe2">
                    </el-option>
                </el-select>
            </el-descriptions-item>
        </el-descriptions>
        <el-descriptions column="1" direction="vertical" border>
            <el-descriptions-item label="1.你觉得目前压力大吗(单选)" prop="resource">
                <el-radio-group v-model="ruleForm1.resource">
                    <el-radio label="1">没什么压力</el-radio>
                    <el-radio label="5">一般</el-radio>
                    <el-radio label="10">压力较大</el-radio>
                    <el-radio label="20">快要崩溃</el-radio>
                </el-radio-group>
            </el-descriptions-item>
            <el-descriptions-item label="2.你觉得自己经常处于哪种状况(单选)" prop="resource1">
                <el-radio-group v-model="ruleForm1.resource1">
                    <el-radio label="1">快乐</el-radio>
                    <el-radio label="5">平稳</el-radio>
                    <el-radio label="10">焦虑</el-radio>
                    <el-radio label="20">悲观</el-radio>
                </el-radio-group>
            </el-descriptions-item><el-descriptions-item label="3.你认为自己的交友状况如何(单选)" prop="resource2">
                <el-radio-group v-model="ruleForm1.resource2">
                    <el-radio label="1">非常好，交友满天下</el-radio>
                    <el-radio label="5">有很多朋友，但没几个知心朋友</el-radio>
                    <el-radio label="10">朋友不多，有几个知心的就行</el-radio>
                    <el-radio label="20">不善交际，没什么朋友</el-radio>
                </el-radio-group>
            </el-descriptions-item>
            <el-descriptions-item label="4.当遇到压力或烦心事时，你通常会(多选)" prop="type">
                <el-checkbox-group v-model="ruleForm1.type">
                    <el-checkbox label="1" name="type">烦恼郁闷、焦躁不安</el-checkbox>
                    <el-checkbox label="2" name="type">失眠多梦</el-checkbox>
                    <el-checkbox label="3" name="type">悲观消极</el-checkbox>
                    <el-checkbox label="4" name="type">坚强面对，自我调节</el-checkbox>
                    <el-checkbox label="5" name="type">沉默寡言</el-checkbox>
                    <el-checkbox label="6" name="type">其他</el-checkbox>
                </el-checkbox-group>
            </el-descriptions-item>
            <el-descriptions-item label="5.你出现焦虑的原因有哪些(多选)" prop="type1">
                <el-checkbox-group v-model="ruleForm1.type1">
                    <el-checkbox label="1" name="type1">学业问题</el-checkbox>
                    <el-checkbox label="2" name="type1">人际关系问题</el-checkbox>
                    <el-checkbox label="3" name="type1">个人前途问题</el-checkbox>
                    <el-checkbox label="4" name="type1">恋爱问题</el-checkbox>
                    <el-checkbox label="5" name="type1">经济问题</el-checkbox>
                    <el-checkbox label="6" name="type1">其他</el-checkbox>
                </el-checkbox-group>
            </el-descriptions-item>
            <el-descriptions-item label="6.遇到困扰你一般会向谁请教(多选)" prop="type2">
                <el-checkbox-group v-model="ruleForm1.type2">
                    <el-checkbox label="1" name="type2">家人</el-checkbox>
                    <el-checkbox label="2" name="type2">亲友</el-checkbox>
                    <el-checkbox label="3" name="type2">男/女朋友</el-checkbox>
                    <el-checkbox label="4" name="type2">知心朋友</el-checkbox>
                    <el-checkbox label="5" name="type2">老师、学长、学姐</el-checkbox>
                    <el-checkbox label="6" name="type2">专业人员</el-checkbox>
                    <el-checkbox label="7" name="type2">不找</el-checkbox>
                </el-checkbox-group>
            </el-descriptions-item>
            <el-descriptions-item label="7.心理自述:" prop="desc">
                <el-input type="textarea" v-model="ruleForm.userCrisisText"></el-input>
            </el-descriptions-item>
        </el-descriptions>
        <el-descriptions>
            <el-descriptions-item>
                <el-button type="primary" @click="add">提交</el-button>
            </el-descriptions-item>
        </el-descriptions>
    </el-form>
</template>

<script>
    import {addInit} from "@/api/InitiaVisit/index.js"
export default {
    data() {
        return {
            dialogVisible: false,
            studentInfo: {
                stuId: "",
                stuNum: "",
                stuSex: "",
                stuAge: "",
                stuPhone: "",
                stuGrade: "",
                stuName: "",
                stuAddress: "",
                stuMajor: "",
                userCrisisText:""
            },
            ruleForm: {
                // num: '',
                // name: '',
                // age: '',
                // sex: '',
                // phone: '',
                // address: '',
                // major: '',
                // grade: '',
                time: '',
                time1: '',
                userCrisisText:''
            },
            ruleForm1: {
                type: [],
                type1: [],
                type2: [],
                resource: "",
                resource1: "",
                resource2: "",
            },
            options: [{
                value: '1',
                label: '周一'
            }, {
                value: '2',
                label: '周二'
            }, {
                value: '3',
                label: '周三'
            }, {
                value: '4',
                label: '周四'
            }, {
                value: '5',
                label: '周五'
            }],
            options1: [{
                value1: '1',
                labe2: '8:00-9:00'
            }, {
                value1: '2',
                labe2: '10:00-11:00'
            }, {
                value1: '3',
                labe2: '13:00-14:00'
            }, {
                value1: '4',
                labe2: '15:00-16:00'
            }],
            score: '',
            length: ''
        }

    },
    methods: {
      async  add() {
          this.studentInfo = this.$store.state.userInfo;
          console.log(this.studentInfo);
          const {data:res}=await  addInit(this.studentInfo);
          console.log(res);

        },

    }

}
</script>

<style scoped>
.el-input {
    width: 300px;
}
</style>